<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>附件编辑</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no"/>
    <meta name="renderer" content="webkit"/>
    <meta name="force-rendering" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <link rel="stylesheet" href="/static/admin/static/component/pear/css/pear.css" />
    <link href="/static/public/libs/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/admin/pages/attach/css/attach-edit.css?v=#(version)" rel="stylesheet"/>
</head>
<body>
<form class="layui-form" lay-filter="addForm">
    <div class="mainBox">
        <div class="main-container">
            <div class="p-container layui-row">
                <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
                    #if(attach.type == 'img')
                    <a href="#(attach.url)" title="#(attach.name)" target="_blank">
                        <img src="#(attach.url)" width="100%">
                    </a>
                    #else if(attach.type == 'video')
                        <video width="100%" height="100%" controls="controls" style="object-fit: fill;"  preload="none">
                            <source src="#(attach.url)"  type="video/mp4">
                            <source src="#(attach.url)" type="video/ogg">
                            <source src="#(attach.url)" type="video/webm">
                            <!-- 同一视频的兼容性写法 -->
                            Your browser does not support the video tag.
                        </video>
                    #else if(attach.type == 'audio')
                        <audio controls preload="none" >
                            <source src="#(attach.url)" type="audio/ogg">
                            <source src="#(attach.url)" type="audio/mpeg">
                            您的浏览器不支持 audio 元素。
                        </audio>
                    #else
                        该文件暂不支持预览
                    #end
                </div>
                <div class="layui-col-xs12 layui-col-sm6 layui-col-md6 editForm">
                        <div class="layui-input-inline"  style="display: none;">
                            <select lay-verify="" type="hidden"></select>
                        </div>
                        <input type="hidden" name="id" class="layui-input" value="#(attach.id)">
                        <div class="layui-form-item">
                            <label class="label">文件名:</label>
                            <input type="text" value="#(attach.name)" name="name" id="name" placeholder="请输入文件名" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="label">文件类型 (#(attach.suffix)):</label>
                            <input type="text" value="#(attach.type)" name="type" id="type" readonly class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="label">存储方式:</label>
                            <input type="text" value="#(attach.saveType)" name="saveType" id="saveType" readonly class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="label">访问地址:</label>
                            <input type="text" value="#(attach.url)" name="url" id="url" readonly class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="label">描述:</label>
                            <textarea placeholder="请输入文件描述" name="desc" id="desc" class="layui-textarea" style="resize: none;min-height: 50px;">#(attach.desc)</textarea>
                        </div>
                        <div class="layui-form-item">
                            <label class="label">文件标识:</label>
                            <input type="text" value="#(attach.flag)" name="flag" id="flag" placeholder="请输入文件标识" autocomplete="off" class="layui-input">
                        </div>
                </div>

            </div>
        </div>
    </div>

    <div class="bottom">
        <div class="button-container">

            <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" onclick="downloadFile('#(attach.id)')">
                <i class="fa fa-download" aria-hidden="true"></i> 下载
            </button>
            <button type="submit" lay-submit lay-filter="addForm" class="pear-btn pear-btn-primary pear-btn-sm">
                <i class="fa fa-check" aria-hidden="true"></i> 保存
            </button>
            <button type="button" class="pear-btn pear-btn-danger pear-btn-sm" onclick="deleteData('#(attach.id)');">
                <i class="fa fa-trash" aria-hidden="true"></i> 删除
            </button>

            <button type="button" class="pear-btn pear-btn-sm p-cancel-btn">
                <i class="fa fa-close" aria-hidden="true"></i> 取消
            </button>
        </div>
    </div>
</form>
<script src="/static/public/libs/layui-v2.5.6/layui/layui.js"></script>
<script src="/static/admin/static/component/pear/pear.js"></script>
<script src="/static/admin/pages/attach/js/attach_edit.js?v=#(version)"></script>
</body>
</html>